package com.netflix.controller;

import com.netflix.dto.UserDTO;
import com.netflix.feign.DemoProviderFeign;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author ytj
 * @date 2021/12/16
 */
@RestController
public class DemoConsumerController {
    @Resource
    private DemoProviderFeign demoProviderFeign;

    @GetMapping("/test_get_demo1")
    public UserDTO getTest(UserDTO userDTO){
        return this.demoProviderFeign.getDemo(userDTO);
    }

    @GetMapping("/test_get_demo2")
    public UserDTO getTest(String id,String name){
        return this.demoProviderFeign.getDemo(id,name);
    }

    @GetMapping("/test_get_demo3")
    public UserDTO getTest(@RequestParam Map<String,Object> map){
        return this.demoProviderFeign.getDemo(map);
    }

    @PostMapping("/test_post_demo")
    public UserDTO postTest(UserDTO userDTO){
        return this.demoProviderFeign.postDemo(userDTO);
    }
}
